/*
 * Created by SharpDevelop.
 * User: Oscar
 * Date: 29/09/2007
 * Time: 07:43 p.m.
 * 
 * To change this template use Tools | Options | Coding | Edit Standard Headers.
 */

using System;
using System.Web;
using System.Collections.Specialized;

namespace DemoPress.UrlRewriting
{
	/// <summary>
	/// This Context encapsulates the virtual path paramteres.
	/// </summary>
	public class UrlRewriteContext
	{
		private NameValueCollection _params;
		private string _initialUrl;
		
		public NameValueCollection Params {
			get { return _params; }
			set { _params = value; }
		}
		
		public string InitialUrl {
			get { return _initialUrl; }
			set { _initialUrl = value; }
		}
		
		
		public static UrlRewriteContext CurrentContext
		{
			get
			{
				if(HttpContext.Current.Items.Contains("UrlRewriteContext"))
				{
					return (UrlRewriteContext)HttpContext.Current.Items["UrlRewriteContext"];
				}
				else
				{
					return new UrlRewriteContext();
				}
			}
		}
		
		public UrlRewriteContext()
		{
			this._params = new NameValueCollection();
			this._initialUrl = String.Empty;
		}
		public UrlRewriteContext(NameValueCollection param, string initialUrl)
		{
			this._params = new NameValueCollection(param);
			this._initialUrl = initialUrl;
		}
		
		
	}
}
